package com.atguign.gulimall.member.web;

import com.alibaba.fastjson.JSONArray;
import com.atguign.gulimall.member.feign.OrderFeifnService;
import com.atguigu.common.utils.R;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.HashMap;
@Slf4j
@Controller
public class OrderPageController {
    @Autowired
    OrderFeifnService orderFeifnService;
    @GetMapping("/orderList.html")
    public String orderListPage(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum, Model model) {
        HashMap<String, Object> page = new HashMap<>();
        page.put("page", pageNum);
        R r = orderFeifnService.listWithItem(page);
        log.debug("查询到订单数据：{}", JSONArray.toJSONString(r.get("page")));
        model.addAttribute("page",r.get("page"));
        return "list";
    }
}
